const {
    override,
    addWebpackAlias,
    fixBabelImports,
    addLessLoader
} = require('customize-cra');
const path = require('path')

const overConfig  = override(
    // 配置路径别名
    addWebpackAlias({
        '@': path.resolve('src')
    }),
    // 针对antd 实现按需打包：根据import来打包 (使用babel-plugin-import)
    fixBabelImports('import', {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: true,
    }),
    // 重新定义antd全局样式
    addLessLoader({
        javascriptEnabled: true,
         //modifyVars: { '@primary-color': '#009688' },
    }),
);

module.exports = function (config, env) {
    return overConfig(config, env)
}
